library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.4.4
library(ggmap)
## Warning: package 'ggmap' was built under R version 3.4.4
## Google's Terms of Service: https://cloud.google.com/maps-platform/terms/.
## Please cite ggmap if you use it! See citation("ggmap") for details.
library(dplyr)
## Warning: package 'dplyr' was built under R version 3.4.4
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
wawa_df <- readRDS('data/wawa_df.Rds')
osm_df <- readRDS('data/osm_df.Rds')

New Wawa in Glenside

Motivation

Goodman Properties is planning a Wawa with gas (“Super Wawa”) at the corner of Easton Road and Waverly Road in Glenside, PA.

Concerns from neighbors and the community were raised about safety, traffic, and the juxtaposition with smaller scale properties and businesses in the area.

There are also two other Wawa locations already in close proximity.

  • Are other Super Wawa locations in similar areas?
  • Are other Super Wawa locations this close to other Wawas?

Step 1: Query data on Wawa locations in Northeast

Retrieved the Wawa locations from wawa.com for the area around Glenside, PA. Retrieved data on 485 unique Wawa locations (PA, NJ, DE, MD). Wawa.com data does not include detailed information on location size, number of pumps, etc.

  • 470/485 Wawa locations are open 24 hours
  • 280/485 Wawa locations have gas
  • 280/485 Wawa locations have restrooms

Here is a map of all the locations in the dataset:

mapdf <- wawa_df[,c("long","lat")]
mapdf$new <- c(rep("exists",nrow(wawa_df)-1),"new")

# getting the map
mapgilbert <- get_map(location = c(lon = mean(mapdf$long), lat = mean(mapdf$lat)), zoom = 8,
                      maptype = "hybrid", scale = 2)
## Source : https://maps.googleapis.com/maps/api/staticmap?center=39.985222,-75.074544&zoom=8&size=640x640&scale=2&maptype=hybrid&language=en-EN&key=xxx
## Warning in strptime(x, fmt, tz = "GMT"): unknown timezone 'zone/tz/2019a.
## 1.0/zoneinfo/America/New_York'
# plotting the map with some points on it
ggmap(mapgilbert) +
  geom_point(data = mapdf, aes(x = long, y = lat, fill = new, alpha = 0.9), size = 2, shape = 21) +
  guides(fill=FALSE, alpha=FALSE, size=FALSE)

Proposed new Wawa site

The proposed Wawa is at 200 S Easton Rd.

# ZOOM in on new wawa
new_wawa <- data.frame(long = c(-75.155848, -75.155848-0.005, -75.155848+0.005),
                       lat = c(40.098564, 40.098564-0.005, 40.098564+0.005))
map_new <- get_map(location = c(lon = new_wawa$long[1], lat = new_wawa$lat[2]), zoom = 15,
                      maptype = "hybrid", scale = 2)
## Source : https://maps.googleapis.com/maps/api/staticmap?center=40.093564,-75.155848&zoom=15&size=640x640&scale=2&maptype=hybrid&language=en-EN&key=xxx
# plotting the map with some points on it
ggmap(map_new) +
  geom_point(data = new_wawa, aes(x = long, y = lat, fill = "red", alpha = 0.9), size = 2, shape = 21) +
  guides(fill=FALSE, alpha=FALSE, size=FALSE) + 
  scale_y_continuous(limits = c(40.098564-0.005, 40.098564+0.005)) +
  scale_x_continuous(limits = c(-75.155848-0.005, -75.155848+0.005)) +
  NULL
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'x' is already present. Adding another scale for 'x', which
## will replace the existing scale.
## Warning: Removed 1 rows containing missing values (geom_rect).

Step 2: Annotate Wawa locations with data from OpenStreetMaps

  1. Retrieve number of lanes and max speed limit of road (can we do this better with other data source???)
  • May be misleading because nearest road might be a driveway or side road off of a major highway
  • Lanes and speed are not available for most Wawa coordinates
  • Also counted the number of motorways in a set area around wawa location (https://wiki.openstreetmap.org/wiki/Key:highway)
  1. Count the number of houses in set area around wawa location
  • Not all residences are on openstreetmaps, but this provides a surrogate of density
  1. Calculate the distance to the nearest Wawa and the number of Wawa locations within a set area

Results: The new Wawa will be close to other Wawa locations

The distance to the nearest Wawa from each Wawa location was calculated in meters. The shortest distance between the Wawa coordinates was calculated according to the ‘Vincenty (ellipsoid)’ method as implemented in the ‘geosphere’ R package.

new_dist <- wawa_df$min_dist_wawa[wawa_df$storeName=="NEW"]

The closest Wawa to the proposed location will be 1028.0010513 meters from the nearest Wawa. That is 0.6387718 miles.

The median distance between locations is 2645.1198825 meters.

wawa_df %>% filter(state %in% c("NJ","PA")) %>% 
  ggplot(aes(x=fuel, y=min_dist_wawa/1609.34)) + 
  geom_hline(yintercept = new_dist/1609.34, color="red", linetype = 2) + 
  geom_boxplot(outlier.shape = NA) + geom_jitter(height = 0, width = 0.2, alpha=0.5) + 
  facet_wrap(~state) +
  ylim(c(0,10)) +
  labs(title = "Distance to nearest Wawa", 
       subtitle = "Dotted red line shows proposed Wawa",
       y="Distance (miles)", x="Does the Wawa have gas?")+
  theme_minimal()
## Warning: Removed 4 rows containing non-finite values (stat_boxplot).
## Warning: Removed 4 rows containing missing values (geom_point).

Results: